const { api, isMock, proxy, moduleName } = require('env.cfg')

const needProxy = (proxy && proxy['needOpen']) || isMock
const moduleCfg = window[moduleName]
const staticHost = moduleCfg && moduleCfg.staticHost ? moduleCfg.staticHost : ''
const host = moduleCfg && moduleCfg.apiHost ? moduleCfg.apiHost : ''

const apiHost = (needProxy ? '' : host) + api
const commHost = needProxy ? '' : host
// console.info('apiHost:', apiHost)

export default {
  resourceUrl: `${staticHost}`,
  userLogin: `${apiHost}/auth/login`,
  userLogout: `${apiHost}/auth/logout`,
  userModifyPass: `${apiHost}/user/modifyPass`,
  quickLogin: `${apiHost}/customer/quick_login`,
  getAuthInfo: `${apiHost}/auth/info`,
  tplDownload: `${commHost}/tpl_download/xls`,
  getCourtomer: `${apiHost}/customer`,
  checkUsername: `${apiHost}/employee/check_name`,
  uploadFile: `${commHost}/upload/file`,

  // 用户管理
  // 员工
  getEmployee: `${apiHost}/employee/page`,
  addEmployee: `${apiHost}/employee/add`,
  updateEmployee: `${apiHost}/employee/edit`,
  getEmployeeInfo: `${apiHost}/employee`,
  getEmployeeEmpPart: `${apiHost}/employee/part_emp_list`,
  importEmployeeCheck: `${apiHost}/employee/import_check`,
  importEmployeeSave: `${apiHost}/employee/import_save`,

  // 管理员
  getUser: `${apiHost}/user/page`,
  addUser: `${apiHost}/user/add`,
  updateUser: `${apiHost}/user/edit`,
  deleteUser: `${apiHost}/user`,
  getUserInfo: `${apiHost}/user`,

  // 课程管理
  getCourse: `${commHost}/course/page`,
  addCourse: `${commHost}/course/add`,
  delCourse: `${commHost}/course/delete`,
  updateCourse: `${commHost}/course/update`,
  getCourseInfo: `${commHost}/course/getById`,
  publishCourse: `${commHost}/course/publish`,
  unPublishCourse: `${commHost}/course/unPublish`,

  // 课时管理
  getLessonFindList: `${commHost}/lesson/findList`,
  addLesson: `${commHost}/lesson/add`,
  updateLesson: `${commHost}/lesson/update`,
  getLessonById: `${commHost}/lesson/getById`,
  publishLesson: `${commHost}/lesson/publish`,
  unPublishLesson: `${commHost}/lesson/unPublish`,
  deleteLesson: `${commHost}/lesson/delete`,

  // 学员管理
  getCourseUserList: `${commHost}/courseUser/course_user_list`,
  addCourseUser: `${commHost}/courseUser/add`,
  deleteCourseUser: `${commHost}/courseUser/delete`,
  importCheckCourseUser: `${commHost}/courseUser/import_check_excel`,
  importSaveCourseUser: `${commHost}/courseUser/import_save_excel`,
  getCourseUserCheckList: `${commHost}/courseUser/course_check_user_list`,
  batchReviewCourseUser: `${commHost}/courseUser/batch_review`,
  getCourseStuGroup: `${commHost}/courseStuGroup/page`,
  addCourseStuGroup: `${commHost}/courseStuGroup/add`,
  updateCourseStuGroup: `${commHost}/courseStuGroup/update`,
  getCourseStuGroupById: `${commHost}/courseStuGroup/getById`,
  deleteCourseStuGroup: `${commHost}/courseStuGroup/delete`,
  getCourseNoGroupUser: `${commHost}/courseUser/find_no_group_user_list`,
  setCourseGroupUser: `${commHost}/courseUser/set_users_group`,

  getCourseUserLabels: `${commHost}/courseUser/user_lable_list`,

  getCourseCheckUser: `${commHost}/courseUser/course_check_user_list`,
  importCourseCheckExcel: `${commHost}/courseUser/import_check_excel`,
  importCourseSaveExcel: `${commHost}/courseUser/import_save_excel`,

  courseSelfGroup: `${commHost}/course/self_group`,
  courseCheckReview: `${commHost}/course/check_review`,

  getLessonUserExercise: `${commHost}/lessonUserExercise/user_exercise_list`,
  getExerciseReport: `${apiHost}/trainee/exercise/getReport`,
  exportLessonUserExercise: `${commHost}/lessonUserExercise/export_user_exercise`,

  getStatCourseStudy: `${commHost}/stat_course_study/course_overview_list`,
  getFlushStatCourseStudy: `${commHost}/stat_course_study/course_overview_list/flush`,

  getStatCourseTrainee: `${commHost}/stat_course_study/course_trainee_list`,
  getFlushStatCourseTrainee: `${commHost}/stat_course_study/course_trainee_list/flush`,

  getStatCourseGroup: `${commHost}/stat_course_study/course_group_list`,
  getFlushStatCourseGroup: `${commHost}/stat_course_study/course_group_list/flush`,

  getStatLessonTrainee: `${commHost}/stat_course_study/lesson_trainee_list`,
  getFlushStatLessonTrainee: `${commHost}/stat_course_study/lesson_trainee_list/flush`,

  getStatLessonGroup: `${commHost}/stat_course_study/lesson_group_list`,
  getFlushStatLessonGroup: `${commHost}/stat_course_study/lesson_group_list/flush`,

}
